﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace QuanLyKho
{
    public partial class uctDanhSachNhapKhau : UserControl
    {
        private readonly TaiKhoan taiKhoan;
        public uctDanhSachNhapKhau(TaiKhoan _taiKhoan)
        {
            InitializeComponent();
            taiKhoan = _taiKhoan;
        }

        private void uctDanhSachNhapKhau_Load(object sender, EventArgs e)
        {
            gctDanhSachNhapKhau.DataSource = NhapKhau.getList(taiKhoan);
            gclSoChungTu.FieldName = "SoChungTu";
            gclNgay.FieldName = "Ngay";
            gclNhaCungCap.FieldName = "TenNhaCungCap";
        }

        private void mThem_mGctDanhSachNhapKhau_Click(object sender, EventArgs e)
        {
            uctNhapKhau uctNhap = new uctNhapKhau() { Name = "Nhập khẩu (Thêm mới)" };
            frmQuanLyKho.themTabPages(uctNhap);
        }

        private void gctDanhSachNhapKhau_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                mGctDanhSachNhapKhau.Show(gctDanhSachNhapKhau,e.X, e.Y);
            }
            else if (e.Button == MouseButtons.Left)
            {
                uctNhapKhau uctNhap = new uctNhapKhau() { Name = "Nhập khẩu (Thêm mới)" };
                frmQuanLyKho.themTabPages(uctNhap);
            }
        }
    }
}
